<!DOCTYPE HTML>
2. <html>
3. <head>
    4. <script type="text/javascript">
    5. var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
    6. var msg;
    7. db.transaction(function (tx) {
        8.    tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
        9.    tx.executeSql('INSERT INTO LOGS (id, log) VALUES (1, "foobar")');
        10.    tx.executeSql('INSERT INTO LOGS (id, log) VALUES (2, "logmsg")');
        11.    msg = '<p>Log message created and row inserted.</p>';
        12.    document.querySelector('#status').innerHTML =   msg;
        13. });
    14.
    15. db.transaction(function (tx) {
        16.    tx.executeSql('SELECT * FROM LOGS', [], function (tx, results) {
            17.    var len = results.rows.length, i;
            18.     msg = "<p>Found rows: " + len + "</p>";
            19.     document.querySelector('#status').innerHTML +=   msg;
            20.    for (i = 0; i < len; i++){
                21.       msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
                22.       document.querySelector('#status').innerHTML +=   msg;
                23.     }
            24. }, null);
        25. });
    26. </script>
    27. </head>
28. <body>
29. <div id="status" name="status">Status Message</div>
30. </body>
31. </html>